<template>
    <art-table class="table" :data="tableData" :pagination="false" size="large" :border="false" :stripe="false"
        :show-header-background="false" :height="500" :currentPage="pageNum" :pageSize="pageSize" :total="pageTotal"
        @current-change="currentChange" @size-change="sizeChange">
        <template #default>
            <el-table-column label="日期" prop="createdTime" align="center" />
            <el-table-column label="新增用户" prop="newUsers" align="center" />
            <el-table-column label="新增学员" prop="newStudents" align="center" />
            <el-table-column label="累计用户数" prop="totalUsers" align="center" />
            <el-table-column label="累计学员数" prop="totalStudents" align="center" />
        </template>
    </art-table>
</template>
<script lang="ts" setup>
import { getUserProfile } from '@/api/questionbank'

const tableData = ref([])

const pageNum = ref(1)
const pageSize = ref(10)
const pageTotal = ref(0)

const getData = async () => {
    const res = await getUserProfile({
        pageSize: pageSize.value,
        pageNum: pageNum.value,
    })
    if (res.code === '00000') {
        tableData.value = res.data.list
        pageTotal.value = res.data.total
    }
}

const currentChange = (val: number) => {
    pageNum.value = val
    getData()
}

const sizeChange = (val: number) => {
    pageSize.value = val
    pageNum.value = 1
    getData()
}

onMounted(() => {
    getData()
})
</script>
<style lang="scss" scoped></style>